"""
Base class for minigames.
"""

#  Copyright 2010 Nick Ryder.

#  This file is part of Minigame Mayhem.

#  Minigame Mayhem is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.

#  Minigame Mayhem is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

#  You should have received a copy of the GNU General Public License
#  along with Minigame Mayhem.  If not, see <http://www.gnu.org/licenses/>.

import os

class Minigame:

   def __init__(self, screen, level=0):
      try:
         self.developers
      except AttributeError:
         self.developers = []
      try:
         len(self.artists)
      except AttributeError:
         self.artists = []
      try:
         len(self.testers)
      except AttributeError:
         self.testers = []
      self.level = level
      self.screen = screen
      self.win = False
      path = os.getcwd()
      dir = ""
      while dir != "trunk":
         path, dir = os.path.split(path)[0], os.path.split(path)[1]
      path = os.path.join(path, dir)
      self.datapath = os.path.join(path, "data")

   def run(self):
      "Called to run the game."
      self.load()
      self.start()
      self.main()
      self.finish()

   def load(self):
      "Load any files (images, sounds, etc) to be used."
      pass

   def start(self):
      "Initialise any variables, etc."
      pass

   def main(self):
      "Main game loop."
      pass

   def finish(self):
      "Finish game, determine if won/lost."
      pass
